package cn.wzc.crystal.platform.enhance.support;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Slf4j
@Component
@RequiredArgsConstructor
public class LogEnhancer implements MethodInterceptor {
	private final ObjectMapper objectMapper;

	public Object invoke(MethodInvocation invocation) throws Throwable {
		log.debug("invoke method:{}#{} ,with arguments :{} ", invocation.getMethod().getDeclaringClass().getName(), invocation.getMethod().getName(), Arrays.toString(invocation.getArguments()));
		return invocation.proceed();
	}

}
